Skip list to small

Hi all,

i have a problem, i want to write all links from database into a skip list, but i think the list is to small

Project p
Module m
Object o
Link l  
int ip = 0
int im = 0
int io = 0
int il = 0  
int ill = 0  

string tOut = ""
string sOut = ""
string tIn = ""
string sIn = ""

Skip sk = createString()

for p in database do
{
        for m in p do
        {
                im++    
                for o in entire m do 
                {
                        io++    
                        for l in o -> "*" do
                        {
                                il++
                                tOut = target(l)
                                sOut = source(l)
                                string ss = tOut " " sOut 
                                put(sk, ss, ss)         
                        }
                        for l in o <- "*" do
                        {
                                ill++
                                tIn = target(l)
                                sIn = source(l)
                                string sss = tIn " " sIn 
                                put(sk, sss, sss) 
                        }
                }
        }
        ip++    
}

print ip 
print im
print io 
print il
print ill 

string lkey = ""
for lkey in sk do
{
        print lkey "\n"       
}

Output:

8
113
97089
7604
7604

AND in sk list are sometime 41, or 42, or 43 entries, not more,, it should be 7604 *2? Or am i wrong? 

 

Thanks

 


meinhana - Thu Aug 18 03:47:40 EDT 2016

Re: Skip list to small
Antonio__Norkus - Thu Aug 18 05:19:49 EDT 2016

One problem may be your "for module in project loop"

From the DXL Ref Manual:

Assigns the variable moduleName to be each successive module name (for which the user has read access) in project. This loop includes open or closed modules but only at the top level of the project. This is no longer everything contained in the project. This only works on the user's computer.

If you want all modules in the project, one method is as follows:

Item i
Project p = current
for i in p do
{
    if (isDeleted(i)) continue
    if (type(i) != "Formal") continue
    Module m = read(fullName(i), false)
    if (null(m)) continue
    
    // do your module processing here
        
    close(m)
}

Additionally, for inlinks, you need to use

for LinkRef in o <- "*"  do

otherwise, you will only see inlinks from modules that are currently open

Re: Skip list to small
meinhana - Thu Aug 18 05:28:54 EDT 2016

Antonio__Norkus - Thu Aug 18 05:19:49 EDT 2016

One problem may be your "for module in project loop"

From the DXL Ref Manual:

Assigns the variable moduleName to be each successive module name (for which the user has read access) in project. This loop includes open or closed modules but only at the top level of the project. This is no longer everything contained in the project. This only works on the user's computer.

If you want all modules in the project, one method is as follows:

Item i
Project p = current
for i in p do
{
    if (isDeleted(i)) continue
    if (type(i) != "Formal") continue
    Module m = read(fullName(i), false)
    if (null(m)) continue
    
    // do your module processing here
        
    close(m)
}

Additionally, for inlinks, you need to use

for LinkRef in o <- "*"  do

otherwise, you will only see inlinks from modules that are currently open

Still 43 entries...

Re: Skip list to small
Antonio__Norkus - Thu Aug 18 05:37:01 EDT 2016

Also, you are counting individual links.
But the skip list is recording source/target module names.

The skip list removes duplicate entries, so your skip list contains the set of source/target pairings in your project

Re: Skip list to small
Wolfgang Uhr - Thu Aug 18 07:34:52 EDT 2016

Antonio__Norkus - Thu Aug 18 05:37:01 EDT 2016

Also, you are counting individual links.
But the skip list is recording source/target module names.

The skip list removes duplicate entries, so your skip list contains the set of source/target pairings in your project

The first parameter of the skiplist is an unique index which helps to sort the list itself.

For example:

Skip skpNumber = create();
put (skpNumer, 1, "one");
put (skpNumer, 3, "three");
put (skpNumer, 2, "two");

string sHelp;
for sHelp in skpNumber do {
  print sHelp "\n";
}

put (skpNumer, 2, "another two");

for sHelp in skpNumber do {
  print sHelp "\n";
}

will print

one
two
three
one
another two
three

So you have a Link l and you will place the into the list with no sorting, you can start by:

Skip sk = create(); // instead of createString()

and inside the loop

il++;
// tOut = target(l);
// sOut = source(l);
// string ss = tOut " " sOut;
put(sk, il, l);

Re: Skip list to small
meinhana - Fri Aug 19 02:11:13 EDT 2016

Antonio you are right! Thank you all for your help

And thank you too, Wolfgang !

Now i understand it :)